package com.nervenets.general.utils;

import com.nervenets.general.entity.MatchedResult;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public final class MatchedUtil {
    private static final String PROPERTIES_CODE_PATTERN = "\\{(.+?)\\}";

    public static MatchedResult<String> isPropertiesCode(String str) {
        Pattern r = Pattern.compile(PROPERTIES_CODE_PATTERN);
        Matcher m = r.matcher(str);
        final boolean found = m.find();
        return new MatchedResult<>(found, found ? m.group(1) : null);
    }
}
